package com.ruowei.modules.wxpay.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;

/**
 * 退款失败记录表
 */
@ApiModel(description = "退款失败记录表")
@Entity
@Table(name = "refund_failed_record")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class RefundFailedRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @Column(name = "order_code")
    private String orderCode;

    /**
     * 退款编码
     */
    @ApiModelProperty(value = "退款编码")
    @Column(name = "order_rerun_code")
    private String orderRerunCode;

    /**
     * 时间
     */
    @ApiModelProperty(value = "时间")
    @Column(name = "jhi_time")
    private Instant time;

    /**
     * 退款金额
     */
    @ApiModelProperty(value = "退款金额")
    @Column(name = "amount", precision = 21, scale = 2)
    private BigDecimal amount;

    /**
     * 微信返回信息，如非空，为错误原因  签名失败 参数格式校验错误
     */
    @ApiModelProperty(value = "微信返回信息，如非空，为错误原因  签名失败 参数格式校验错误")
    @Column(name = "return_msg")
    private String returnMsg;

    /**
     * SUCCESS/FAIL  SUCCESS退款申请接收成功，结果通过退款查询接口查询 FAIL 提交业务失败
     */
    @ApiModelProperty(value = "SUCCESS/FAIL  SUCCESS退款申请接收成功，结果通过退款查询接口查询 FAIL 提交业务失败")
    @Column(name = "result_code")
    private String resultCode;

    /**
     * 错误代码
     */
    @ApiModelProperty(value = "错误代码")
    @Column(name = "err_code")
    private String errCode;

    /**
     * 错误代码描述
     */
    @ApiModelProperty(value = "错误代码描述")
    @Column(name = "err_code_des")
    private String errCodeDes;

    /**
     * 微信支付订单号
     */
    @ApiModelProperty(value = "微信支付订单号")
    @Column(name = "transaction_id")
    private String transactionId;

    /**
     * 微信退款单号
     */
    @ApiModelProperty(value = "微信退款单号")
    @Column(name = "refund_id")
    private String refundId;

    /**
     * 是否退款成功
     */
    @ApiModelProperty(value = "是否退款成功")
    @Column(name = "status")
    private Boolean status;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public RefundFailedRecord orderCode(String orderCode) {
        this.orderCode = orderCode;
        return this;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getOrderRerunCode() {
        return orderRerunCode;
    }

    public RefundFailedRecord orderRerunCode(String orderRerunCode) {
        this.orderRerunCode = orderRerunCode;
        return this;
    }

    public void setOrderRerunCode(String orderRerunCode) {
        this.orderRerunCode = orderRerunCode;
    }

    public Instant getTime() {
        return time;
    }

    public RefundFailedRecord time(Instant time) {
        this.time = time;
        return this;
    }

    public void setTime(Instant time) {
        this.time = time;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public RefundFailedRecord amount(BigDecimal amount) {
        this.amount = amount;
        return this;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public String getReturnMsg() {
        return returnMsg;
    }

    public RefundFailedRecord returnMsg(String returnMsg) {
        this.returnMsg = returnMsg;
        return this;
    }

    public void setReturnMsg(String returnMsg) {
        this.returnMsg = returnMsg;
    }

    public String getResultCode() {
        return resultCode;
    }

    public RefundFailedRecord resultCode(String resultCode) {
        this.resultCode = resultCode;
        return this;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public RefundFailedRecord errCode(String errCode) {
        this.errCode = errCode;
        return this;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public RefundFailedRecord errCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
        return this;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public RefundFailedRecord transactionId(String transactionId) {
        this.transactionId = transactionId;
        return this;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getRefundId() {
        return refundId;
    }

    public RefundFailedRecord refundId(String refundId) {
        this.refundId = refundId;
        return this;
    }

    public void setRefundId(String refundId) {
        this.refundId = refundId;
    }

    public Boolean isStatus() {
        return status;
    }

    public RefundFailedRecord status(Boolean status) {
        this.status = status;
        return this;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof RefundFailedRecord)) {
            return false;
        }
        return id != null && id.equals(((RefundFailedRecord) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "RefundFailedRecord{" +
            "id=" + getId() +
            ", orderCode='" + getOrderCode() + "'" +
            ", orderRerunCode='" + getOrderRerunCode() + "'" +
            ", time='" + getTime() + "'" +
            ", amount=" + getAmount() +
            ", returnMsg='" + getReturnMsg() + "'" +
            ", resultCode='" + getResultCode() + "'" +
            ", errCode='" + getErrCode() + "'" +
            ", errCodeDes='" + getErrCodeDes() + "'" +
            ", transactionId='" + getTransactionId() + "'" +
            ", refundId='" + getRefundId() + "'" +
            ", status='" + isStatus() + "'" +
            "}";
    }
}
